package day07;

import java.io.FileNotFoundException;
import java.io.RandomAccessFile;

public class Demo02 {

	public static void main(String[] args) throws Exception {
		
		String name="abc/hello.txt";
		RandomAccessFile raf=new RandomAccessFile(name,"rw");
		
		raf.writeInt(127832);
		long p=raf.getFilePointer();
		System.out.println(p);
		raf.seek(0);
		int n=raf.readInt();
		System.out.println(n);
		p=raf.getFilePointer();
		System.out.println(p);

		
		raf.seek(0);
		raf.writeDouble(3213.324);
		p=raf.getFilePointer();
		System.out.println(p);
		raf.seek(0);
		double m=raf.readDouble();
		System.out.println(m);
		p=raf.getFilePointer();
		System.out.println(p);
		
		raf.seek(0);
		raf.writeLong(220987654321L);
		p=raf.getFilePointer();
		System.out.println(p);
		raf.seek(0);
		long x=raf.readLong();
		System.out.println(x);
		p=raf.getFilePointer();
		System.out.println(p);
		
		raf.seek(0);
		raf.writeChars("abcdefghijklm");
		p=raf.getFilePointer();
		System.out.println(p);
		raf.seek(0);
		
		p=raf.getFilePointer();
		System.out.println(p);
		
		raf.close();
		
	}

}
